import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [


  //重定向
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login.vue'),
    children: [{
      //管理员登录
      path: 'adminsLogin',
      component: () => import('../components/login/adminsLogin.vue')
    },
    {
      //销售员登录
      path: 'salesmansLogin',
      component: () => import('../components/login/salesmansLogin.vue')
    }
    ]
  },
  {
    path: '/salesmansSystem',
    name: 'SalesmansSystem',
    props: true,
    component: () => import('../views/SalesmansSystem.vue'),

    children: [{
      path: 'salesmansOrderList',
      name: 'salesmansOrderList',
      component: () => import('../components/seller/SellerOrderList.vue')
    },
    {
      path: 'salesmansOrderToCancel',
      name: 'salesmansOrderToCancel',
      component: () => import('../components/seller/SellerOrderToCancel.vue')
    }, {
      path: 'customersAdd',
      name: '/CustomersAdd',
      component: () => import('../components/salesSystem/customers/CustomersAdd.vue')
    },
    {
      path: 'myCustomers',
      name: '/MyCustomers',
      component: () => import('../components/salesSystem/customers/MyCustomers.vue')
    },
    ]
  },
  {
    path: '/adminsSystem',
    name: 'Admins-system',
    component: () => import('../views/AdminsSystem.vue'),
    children: [

      {
        path: 'adminsList',
        component: () => import('../components/admins/AdminsList.vue'),
      },
      {
        path: 'adminsSystem',
        component: () => import('../components/admins/AdminsAdd.vue'),
      },
      {
        path: 'updateAdmin/:_id',
        props: true,
        component: () => import('../components/admins/updateAdmin.vue'),
      }, 
      {
        path: 'salesmansList',
        name: 'SalesmansList',
        component: () => import('../components/salesmans/salesmansList .vue'),
      },
      {
        path: 'salesmansAdd',
        name: 'SalesmansAdd',
        component: () => import('../components/salesmans/salesmansAdd.vue')
      },
      {
        path: 'salesmansAmend',
        name: 'SalesmansAmend',
        component: () => import('../components/salesmans/salesmansAmend.vue')
      },
      {
        path: 'orderList',
        name: 'OrderList',
        component: () => import('../components/order/OrderList.vue')
      },
      {
        path: 'orderPayState',
        name: 'OrderPayState',
        component: () => import('../components/order/OrderPayState.vue')
      },
      {
        path: 'customersList',
        name: '/CustomersList',
        component: () => import('../components/adminsSystem/customers/CustomersList.vue')
      },
      {
        //保险产品列表
        path: 'insuresList',
        component: () => import('../components/insures/InsuresList.vue')
      },
      {
        //新增产品
        path: 'insuresAdd',
        component: () => import('../components/insures/InsuresAdd.vue')
      },
      {
        //修改产品
        path: 'insuresUpdate/:_id',
        component: () => import('../components/insures/InsuresUpdate.vue'),
        props: true
      },
      {
        path: 'claimsList',
        component: () => import('../components/claims/claimsList.vue'),
      },
      {
        path: 'claimsAdd',
        component: () => import('../components/claims/claimsAdd.vue'),
      },
      {
        path: 'claimsUpdate/:_id',
        props: true,
        component: () => import('../components/claims/claimsUpdate.vue'),
      },
    ]
  },
]



const router = new VueRouter({
  routes
})

export default router